fid = fopen('c:\manoj\projects\bio-NN\splice.symb.data.txt','rt');
icount=1;
while 1
tline = fgetl(fid);
if ~ischar(tline), break, end; S1(:,icount) = tline;icount=icount+1;
disp(tline)
end
fclose(fid);
S1 = S1';
DATA = S1(:,1:60);
TG = S1(:,62:63);
TG1 = zeros([3190,3]);
DATA1 = zeros([3190,60]);
L = DATA == 'A';
DATA1(L) = 1;
L = DATA == 'G';
DATA1(L) = 2;
L = DATA == 'T';
DATA1(L) = 3;
L = DATA == 'C';
DATA1(L) = 4;
L = DATA == 'D';
L = DATA == 'N';
L = DATA == 'S';
L = DATA == 'R';

L = TG(:,1) == 'E' & TG(:,2) == 'I';
TG1(L,1) = 1;
L = TG(:,1) == 'I' & TG(:,2) == 'E';
TG1(L,2) = 1;
L = TG(:,1) == 'N' & TG(:,2) == 'A';
TG1(L,3) = 1;

shuffle = randperm(length(DATA1));
DATA2 = DATA1(shuffle,:);
TG2 = TG1(shuffle,:);


ptrain = DATA2(1:1000,:)'/4; %to normalize
ttrain = TG2(1:1000,:)';
hiddn = 3;
mu = 0.001;
for hiddn = 3:8,
   for mu = 0.001:0.002:0.01,
net = newff(minmax(ptrain),[hiddn,3],{'logsig','purelin'});
net.trainParam.mu = mu;
[net,tr] = train(net,ptrain,ttrain);

ptest = DATA2(2001:3000,:)';
ttest = TG2(2001:3000,:)';
a = sim(net,ptest);
fprintf('%d %10.5f\n', hiddn,mu);
a==max(a)
L1 = a(1,:) == max(a)
L2 = a(2,:) == max(a)
L3 = a(3,:) == max(a)
L = [L1;L2;L3]


% a = sim(net,ptest(:,randperm(length(ptest)))); %Just to check with 
% sum(abs(a'-ttest'))
    end;
end;



